Window Class

Any window.

Events

Activate

KeyDown

MouseUp

CancelClose

Maximize

Moved

Close

Minimize

Open

ConstructContextualMenu

MouseDown

Paint

ContextualMenuAction

MouseDrag

Resized

Deactivate

MouseEnter

Resizing

DropObject

MouseExit

Restore

EnableMenuItems

MouseMove

 

Properties

Backcolor

Graphics

MinHeight

Backdrop

Handle

MinimizeButton

BalloonHelp

HasBackColor

MinWidth

CloseButton

Height

MouseCursor

Composite

Left

MouseX

Control

LiveResize

MouseY

ControlCount

MacProcID

Placement

DockItem

MaxHeight

Resizable

FloaterProcess

MaximizeButton

Title

Focus

MaxWidth

Top

Frame

MenuBar

Visible

FullScreen

MenuBarVisible

Width


Methods

AcceptFileDrop

Hide

SetFocus

AcceptPictureDrop

Maximize

Show

AcceptRawDataDrop

Minimize

ShowModal

AcceptTextDrop

Refresh

ShowModalWithin

Close

RefreshRect

ShowWithin

DrawInto

Restore

UpdateNow


More information available in parent classes: Object


Notes

Window constructors are called after the window and its controls are created, but before the Open events are called.

The Composite Property

The Composite property solves a display problem that occurs under Mac OS X. In certain cases, a control that is placed in a Metal or Drawer window or on top of another control shows its rectangular border as a white background unless the window's Composite property is turned on. The problem doesn't come up if the controls are intrinsically rectangular. For Drawer and Metal window types, the Composite property is turned on automatically. The problem can also occur in regular Document windows. For example, some controls that are placed on top of a Placard control in a Document window show this problem.

Turning on the Composite property removes the unsightly white rectangles around each control.

Custom Window Types

If the MacProcID property is set to a non-zero value (which can be done in the IDE only), the window will be drawn according to this value. When you do so, the behaviour of the window will correspond to the value of the Frame property, but the appearance is controlled by the Window Definition provided by MacProcID.This feature allows you to define window types that are not defined directly by REALbasic (i.e, via the Frame property).

For a discussion of MacProcID values, see the Apple developer documentation "Window Definition IDs" at http://developer.apple.com/techpubs/macos8/HumanInterfaceToolbox/WindowManager/WindowMgr8Ref/WindowMgrRef.b.html.

The following table summarizes the possible values of MacProcID. Values of 1024 to 1087 require the Appearance Manager (Mac OS 8 or above); other values are pre-Appearance Manager. On Windows, the value of the Frame property controls the window type regardless of the value of MacProcID.

ValueDescription
1 Modal dialog box
2 Modeless dialog box
3 Modeless dialog box with shadow
4 Movable window with no size box
5 Movable dialog box with title bar
8 Movable window with zoom box and size box
12 Movable window with zoom box and no size box
16 Round corner window (adding 2, 4, or 6 to 16 changes the curvature of the corners)
1024 Movable window with no size box or zoom box
1025 Movable window with size box
1026 Movable window with vertical zoom box and no size box
1027 Movable window with vertical zoom box and size box
1028 Movable window with horizontal zoom box and no size box
1029 Movable window with horizontal zoom box and size box
1030 Movable window with full zoom box and no size box
1031 Movable window with full zoom box and size box
1040 Modeless dialog box
1041 Modeless dialog box with shadow
1042 Modal dialog box
1043 Movable modal dialog box
1044 Alert box
1045 Movable alert box
1046 Movable modal dialog box with size box
1057 Floating window with no size box or zoom box
1059 Floating window with size box
1061 Floating window with vertical zoom box
1063 Floating window with vertical zoom box and size box
1065 Floating window with horizontal zoom box
1067 Floating window with horizontal zoom box and size box
1069 Floating window with full zoom box
1071 Floating window with full zoom box and size box
1073 Floating window with side title bar
1075 Floating window with side title bar and size box
1077 Floating window with side title bar and vertical zoom box
1079 Floating window with side title bar, vertical zoom box, and size box
1081 Floating window with side title bar and horizontal zoom box
1083 Floating window with side title bar, horizontal zoom box, and size box
1085 Floating window with side title bar and full zoom box
1087 Floating window with side title bar, full zoom box, and size box
1985 Floating window with no size box or zoom box
1987 Floating window with size box
1989 Floating window with zoom box
1991 Floating window with zoom box and size box
1993 Floating window with side title bar and no size or zoom boxes
1995 Floating window with side title bar and size box
1997 Floating window with side title bar and zoom box
1999 Floating window with side title bar, size box, and zoom box.

Custom Cursors

The MouseCursor property controls the appearance of the pointer when it is over the window, provided the MouseCursor property of the Application class is Nil. If you also want the pointer to change to another shape when it is over a control within the window, you must either assign the new value to the Window's MouseCursor property or temporarily set the window's MouseCursor property to Nil and the control's MouseCursor property to the desired cursor. See the section on the MouseCursor class for an example.

You can assign a MouseCursor using the library of cursors in the Cursors object.


Examples

This example sets the background color of the window to grey, provided the HasBackColor property is set to True.

backcolor= RGB(80,80,80)

This example increases the width of the window by 20 pixels.

width=width+20

This example changes the title of the window.

title="Document 1"

The Resizing Event Handler

This example resizes three EditFields on the form in the Resizing event.The three EditFields are aligned horizontally. As the user stretches or shrinks the window, the EditFields' widths change proportionally.

Dim availableSpace as Integer
Dim field1size, field2size, field3size as Integer
  
//subtract 40 pixels for the space between the
//three fields and on left and right side of the window
availableSpace=me.width-40
  
//calculate the size of each field based on a percentage
Field1size=availableSpace*.6 //60 percent
Field2size=availableSpace*.3 //30 percent
Field3size=availableSpace*.1 //10 percent
  
//Set the field widths
Editfield1.width=field1size
Editfield2.width=field2size
Editfield3.width=field3size
  
//reposition the fields based on the new sizes
Editfield2.left=editfield1.left+editfield1.width+10
Editfield3.left=editfield2.left+editfield2.width+10

Drawinto Example

This example draws the contents of a window into a Graphics object. For example, if you create a new project, add a second window, and add a Canvas control to the second window then in the Paint event of the first window, put:

Self.drawinto(dialog1.canvas1. Graphics,0,0)

The contents of the first window will be draw into the canvas control on the second window.

Accessing Controls and Properties in Other Windows

When changing a window property from another window, there are two possible approaches you can take. If you have only one instance of the window you need to reference, you can use the window's object name as a reference. For example, if you had a window called window1 that had an EditField called EditField1 and you wanted to assign the value "Fred" to the text property of that EditField, you would using the following syntax:

window1.EditField1.text="Fred"

If you have multiple instances of the same window class open at the same time, then a reference to the target window must be included as in this example where a new window is opened and its window title changed. "anotherWindow" is a window class in the Project Editor.

Dim w As anotherWindow
w= New anotherWindow
w.title="Your Results"

Handling Drag and Drop

For an explanation of handling drag and drop, see the Control class and the DragItem class.


See Also

Window function; MessageDialog class.